package com.spyx.home.controller;


import com.atyx.spyx.model.product.Category;
import com.spyx.product.ProductClient;
import com.spyx.result.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api("商品分类展示")
@RequestMapping("/api/home")
public class CategoryApiController {

    @Autowired
    private ProductClient productClient;

    //查询商品分类
    @GetMapping("/category")
    public Result getcategoryList(){
        //直接调取原来已经定义好的方法
        List<Category> categoryList = productClient.getCategoryList();
        return Result.ok(categoryList);
    }
}
